package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;

public class CHAR extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    for (int i = 0; i < paramArrayOfObject.length; ++i)
      if (paramArrayOfObject[i] instanceof Number)
        return new Character((char)((Number)paramArrayOfObject[i]).intValue());
    return "";
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "CHAR(number): 根据指定数字返回对应的字符。CHAR函数可将计算机其他类型的数字代码转换为字符。\nNumber:用于指定字符的数字，介于1~65535之间（包括1和65535）。\n示例:\nCHAR(88)等于“X”。\nCHAR(45)等于“-”。";
  }

  public String getEN()
  {
    return "CHAR(number): Returns the character specified by a number. Use CHAR to translate code page numbers you    might get from files on other types of computers into characters.\n   Number:Number is a number between 1 and 65535 specifying which character you want.(Include 1 and 65535)\nExample:\n   CHAR(88)=\"X\"\n   CHAR(45)=\"-\"";
  }
}